#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    timeId = this->startTimer(1000);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::timerEvent(QTimerEvent *e)
{
    if(e->timerId() != timeId)
        return ;

    int value = ui->lcdNumber->value();
    if(value<=0)
        value = 10;
    else
        value--;
    ui->lcdNumber->display(value);
}
